<?php
/*
File: domains_searches.php
Version: 1.0
Date created: 
Last Edited : 26-07-2008
Author: Craig G Smith<craig@joomla-host.co.za
*/

defined( 'JOSCOM_VERSION' ) or die( 'Direct Access to this location is not allowed.' );

if (defined( '_OSCOMMERCE_LOADED' )) {
    if (!DB_SHARED) {
      tep_db_connect() or die('Unable to connect to database server!');
    }
    global $category_links, $languages_id, $cPath, $cPath_array, $current_category_id;
    global $request_type, $lng, $cart, $currencies, $language, $navigation, $breadcrumb;
  } else {
    require(DIR_WS_COMPONENT . 'includes/application_top.php');
  }
  
$action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');

  if (tep_not_null($action)) {
    switch ($action) {
      case 'delete':
     tep_db_query("Delete from ". TABLE_DOMAINS . " where domid = '" . $_REQUEST['id'] . "'");
       break;
      }
      }
  
  ?>

<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_COMPONENT ?>includes/stylesheet.css">
<script language="javascript" src="<?php echo DIR_WS_COMPONENT ?>includes/general.js"></script>

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<?php
echo tep_draw_form('adminForm', tep_href_link("domains_searches.php"), "POST");
?>
<input type="hidden" name="limitstart">
<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table>
         <table class="adminlist" cellspacing="1">
        <thead>
              <tr class="dataTableHeadingRow">
                <th class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOMAIN; ?></th>
                
                <th class="dataTableHeadingContent" align="right" width="10%"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</th>
                <th class="dataTableHeadingContent" align="center" width="*"><?php echo TABLE_HEADING_AVAIL;?></th>
              </tr>
              </thead>
              
<?php
$database->setQuery("Select * from " . TABLE_DOMAINS . " order by domid desc");
$rows = $database->loadObjectList();
//this report will still need the domain search saving to db to be updated!!!!
$total = count($rows);
    require_once ($GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php');
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit',25);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $list = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
//publish_x.png
$row = 0;
foreach($list as $dom){
              ?>
              <tr class="dataTableRow<?php echo $row;?>" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
              <td><?php echo $dom->domain;?></td>
              <td><a href="<?php echo tep_href_link("domains_search.php", "action=delete&id=" . $row->domid)?>" border=0><img src="images/publish_x.png" border="0" title="<?php echo TABLE_TEXT_DELETE?>" alt="<?php echo TABLE_TEXT_DELETE?>"></a></td>
              
<td><?php
if($dom->avail){
?>
<img src="images/tick.png" border="0"> 
<?php
}
echo $dom->date;
?>
</td></tr>
              <?php
              $row = 1 - $row;
}              
?>         

<tr><th align = "center" colspan = "3"><center><?php echo $pageNav->writePagesLinks(); ?> <?php echo $pageNav->writeLimitBox(); ?>
                            </th>
                        </tr>

                        <tr>
                            <td align = "center" colspan = "3"> <center><?php echo $pageNav->writePagesCounter(); ?>
                            </td>
                        </tr>
</table></form>     

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->

<?php
  require(DIR_WS_INCLUDES . 'application_bottom.php');

  // -- webMS Modification --
  // reset the Mambo Database connection (stomped by osCommerce Connection)
  if (!DB_SHARED) {
    global $database, $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix;
    $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
  }
?>
